package cn.tedu.charging.order.controller;

import cn.tedu.charging.common.pojo.param.OrderAddParam;
import cn.tedu.charging.common.protocol.JsonResult;
import cn.tedu.charging.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;
    /**
     * 用户 扫码 下单
     * 并不在这个业务中 直接创建成功和失败的结果
     * 需要和设备物联网IoT沟通之后 才能创建订单
     */
    @PostMapping("/order/create")
    public JsonResult<String> createOrder(@RequestBody OrderAddParam orderAddParam){
        String orderNo=orderService.createOrder(orderAddParam);
        return JsonResult.ok(orderNo);
    }
}
